#include <iostream>
#include <string>
#include <vector>
#include <fstream>
#include "Fix.h"
#include "replace_chinese_pun.h"
#include "TabToSpace.h"

using namespace std;

int main1() {
    string a{};
    string b{};
    string temp{};

    cout << "\033[91m═════════════════════════Original═════════════════════════" << endl;

    while (std::getline(std::cin, temp)) {   // 逐行
        string temp_2 = temp;
        temp_2.erase(std::remove_if(temp_2.begin(), temp_2.end(),
                       [](unsigned char c){
                           return c == '\t' || c == '\n' || c == ' ';
                       }),
        temp_2.end());
        if (temp_2 == "fuck!")
         {
              break;
         }
        a += temp + "\n";

    }
    while (std::getline(std::cin, temp)) {   // 逐行
        string temp_2 = temp;
        temp_2.erase(std::remove_if(temp_2.begin(), temp_2.end(),
                       [](unsigned char c){
                           return c == '\t' || c == '\n' || c == ' ';
                       }),
        temp_2.end());
        if (temp_2 == "fuck!")
        {
            break;
        }
        b += temp + "\n";

    }
    cout << "\033[0m" << endl;
    Fix fix{std::move(a), std::move(b) ,1, 22};

    auto r = fix.StartFix();
    cout << "\033[92m═════════════════════════Result═════════════════════════" << endl;
    cout << r;
    cout << "\033[0m" << endl;
    std::ofstream("out.txt", std::ios::binary).write(r.data(), r.size());
    return 0;
}
int main2()
{
    string a{};
    string temp{};

    cout << "\033[91m═════════════════════════Original═════════════════════════" << endl;

    while (std::getline(std::cin, temp)) {   // 逐行
        string temp_2 = temp;
        temp_2.erase(std::remove_if(temp_2.begin(), temp_2.end(),
                       [](unsigned char c){
                           return c == '\t' || c == '\n' || c == ' ';
                       }),
        temp_2.end());
        if (temp_2 == "fuck!")
        {
            break;
        }
        a += temp + "\n";

    }

    cout << "\033[0m" << endl;


    string r = replace_chinese_pun::replace_punctuation(a);
    cout << "\033[92m═════════════════════════Result═════════════════════════" << endl;
    cout << r;
    cout << "\033[0m" << endl;
    std::ofstream("out.txt", std::ios::binary).write(r.data(), r.size());
    return 0;
}

int main()
{
    string a{};
    string temp{};

    cout << "\033[91m═════════════════════════Original═════════════════════════" << endl;

    while (std::getline(std::cin, temp)) {   // 逐行
        string temp_2 = temp;
        temp_2.erase(std::remove_if(temp_2.begin(), temp_2.end(),
                       [](unsigned char c){
                           return c == '\t' || c == '\n' || c == ' ';
                       }),
        temp_2.end());
        if (temp_2 == "fuck!")
        {
            break;
        }
        a += temp + "\n";

    }

    cout << "\033[0m" << endl;

    auto tools = TabToSpace(a);
    string r = tools.TabToSpace_Main();
    r = replace_chinese_pun::replace_punctuation(r);
    cout << "\033[92m═════════════════════════Result═════════════════════════" << endl;
    cout << r;
    cout << "\033[0m" << endl;
    std::ofstream("out.txt", std::ios::binary).write(r.data(), r.size());
    return 0;
}